fix(types): handle generic setup return type#1202
Merged
Conversation
Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
3af1597 to
24190d8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes mypy compatibility with the latest types-setuptools versions (>=80.9) by implementing support for TypeVar with the default parameter. The changes add a compatibility layer for TypeVar with default parameter support and update the setup wrapper function to use generic type annotations.
- Adds TypeVar compatibility wrapper in
_compat/typing.pythat supports thedefaultparameter for Python versions < 3.13 - Updates the
setupfunction insetuptools/wrapper.pyto use generic type parameters, allowing proper typing of thedistclassparameter and return type - Updates types-setuptools version constraint to >=80.9, removing the exclusion of a problematic version
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/scikit_build_core/_compat/typing.py | Adds TypeVar compatibility wrapper that strips the default parameter at runtime for Python < 3.13 while preserving it for type checking via typing_extensions |
| src/scikit_build_core/setuptools/wrapper.py | Updates setup function signature to use generic TypeVar with default, improving type safety for the distclass parameter and return type |
| .pre-commit-config.yaml | Updates types-setuptools version constraint from >=70.1,!=80.9.0.20251221 to >=80.9 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix mypy on current types-setuptools versions.